/*
 * @Date: 2023-01-22 02:17:37
 * @LastEditors: 恶名扬 2080156129@qq.com
 * @LastEditTime: 2023-01-22 07:30:46
 * @FilePath: \campus-repair-platform\server\schema\manage\announce.js
 */
/**
 * add_schema     发布公告
 * update_schema  修改公告
 */

const joi = require("joi")
const { id, a_title: title } = require("../common")

const content = joi.string().min(1).max(20000).error(new Error("内容格式有误"))
const scope = joi.number().min(1).max(4).error(new Error("发布范围格式有误"))

exports.add_schema = {
  body: {
    title: title.required(),
    content: content.required(),
    scope: scope.required(),
  }
}

exports.update_schema = {
  body: {
    id: id.required(),
    title,
    content,
    scope,
  }
}
